package com.be.beadmin.project.entity;

import com.be.beadmin.common.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Objects;

/**
 * @Description: 团队子表
 * @author: Jiaming Zheng
 * @Date: Create in 17:13 2023/1/10
 * @Modified By:
 **/
@Entity
@Table(name="T_PM_TeamInfo")
@Getter
@Setter
public class TeamInfo extends BaseEntity {

    @Column(name = "SerialNo",columnDefinition = "VARCHAR(50) COMMENT '流水号' ")
    private String serialNo;

    /**
     * 关联主表ID
     */
//    @ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.ALL)
//    @JoinColumn(name = "TEAM_ID",columnDefinition = "VARCHAR(45) COMMENT '团队id' not null")
    @Column(name = "TeamId",columnDefinition = "VARCHAR(50) COMMENT '团队id' not null")
    private String teamId;

    @Column(name = "RoleName",columnDefinition = "VARCHAR(50) COMMENT '角色名称' ")
    private String roleName;

    @Column(name = "RoleId",columnDefinition = "VARCHAR(50) COMMENT '角色ID' ")
    private String roleId;

    @Column(name = "Category",columnDefinition = "VARCHAR(50) COMMENT '角色类别' not null")
    private String category;

    @Column(name = "UserName",columnDefinition = "VARCHAR(50) COMMENT '用户名称' not null")
    private String userName;

    @Column(name = "EMAIL",columnDefinition = "VARCHAR(30) COMMENT '电子邮箱' ")
    private String email;

    @Column(name = "PHONE",columnDefinition = "VARCHAR(20) COMMENT '手机登录' ")
    private String phone;

    @Column(name = "UserId",columnDefinition = "VARCHAR(50) COMMENT '用户ID' not null")
    private String userId;

    @Column(name = "Memo",columnDefinition = "VARCHAR(50) COMMENT '备注' ")
    private String memo;

    @Column(name = "Reserved",columnDefinition = "VARCHAR(50) COMMENT '预留' ")
    private String reserved;

    @Override
    public int hashCode() {
        return Objects.hash(userId,userName);
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o instanceof TeamInfo) {
            TeamInfo teamInfo = (TeamInfo) o;
            return teamInfo.userName.equals(userName) && teamInfo.userId.equals(userId);
        }else{
            return false;
        }
    }
}
